package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.ChargeInvoiceRedEntity;
import com.jinmdz.fmis.mapper.mapper.provider.ChargeInvoiceRedProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 发票冲红表Mapper
 *
 * @author generator
 * @date 2020-05-12 14:24
 */
public interface ChargeInvoiceRedMapper {

    /**
     * 增加ChargeInvoiceRed
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-05-12 14:24
     */
    @InsertProvider(type = ChargeInvoiceRedProvider.class, method = "insertChargeInvoiceRed")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertChargeInvoiceRed(@Param("entity") ChargeInvoiceRedEntity entity);

    /**
     * 删除ChargeInvoiceRed
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-05-12 14:24
     */
    @Update(" update charge_invoice_red set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForChargeInvoiceRed(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改ChargeInvoiceRed
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-05-12 14:24
     */
    @UpdateProvider(type = ChargeInvoiceRedProvider.class, method = "updateChargeInvoiceRed")
    void updateChargeInvoiceRed(@Param("entity") ChargeInvoiceRedEntity entity);

    /**
     * 查询ChargeInvoiceRed实体
     *
     * @param id 主键
     * @return ChargeInvoiceRedEntity
     * @author generator
     * @date 2020-05-12 14:24
     */
    @Select(" select id,deleted,business_code,invoice_code,invoice_no,invoice_title,invoice_charge,invoice_time,invoice_state_code,invoice_cancel_no,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from charge_invoice_red where id = #{id} and deleted = 0 limit 1 ")
    ChargeInvoiceRedEntity getChargeInvoiceRedById(@Param("id") Integer id);

    /**
     * 查询ChargeInvoiceRed列表
     *
     * @param entity 数据实体
     * @return ChargeInvoiceRedEntity
     * @author generator
     * @date 2020-05-12 14:24
     */
    @SelectProvider(type = ChargeInvoiceRedProvider.class, method = "listChargeInvoiceRed")
    ArrayList<ChargeInvoiceRedEntity> listChargeInvoiceRed(@Param("entity") ChargeInvoiceRedEntity entity);
}